package com.example.administrator.appstpremvpdemo.view.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

/**
 * @Author Administrator
 * @Date 2017/12/12
 * @description
 * @function
 */

public class LaunchBaseFragment extends Fragment {

    protected ILaunchCommplete mILaunchCommplete;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (activity instanceof ILaunchCommplete) {
            mILaunchCommplete = (ILaunchCommplete) activity;
        }
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


    @Override
    public void onDetach() {
        super.onDetach();
        mILaunchCommplete = null;
    }

    /**
     * 当有多个fragment入口可以跳转到首页的时候，可以在其宿主activity，也就是launchActivity中
     * 集中跳转，让这个主activity实现这个接口
     */
    public interface ILaunchCommplete {
        /**
         * 启动和闪屏逻辑完毕---跳转至首页或者点击闪屏页后指定的页面
         */
        void onLaunchCommplete(Class<?> clazz);
    }
}
